package com.example.mybatistest.controller;



import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.example.mybatistest.dao.Lzx;
import com.example.mybatistest.mapper.Lzxmapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


import java.sql.DriverManager;
import java.util.HashMap;
import java.util.List;

@RestController
@RequestMapping("/login")
public class lzxcontroller {

@Autowired
private Lzxmapper lzxmapper;


    @PostMapping("/login")
    public String login(String name, String money) {
        IPage s=new Page(1,20);//分页  第几页 一页多少条
    lzxmapper.selectPage(s, null);
        List records = s.getRecords();
        System.out.println(records);
        Lzx lzx = new Lzx();
        LambdaQueryWrapper<Lzx> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.eq(null!=lzx.getName(),Lzx::getName,lzx.getName());
        queryWrapper.select(Lzx::getId);
        QueryWrapper<Lzx> queryWrapper1 = new QueryWrapper<>();
        queryWrapper1.select("count(*) as count");
        lzxmapper.selectList(queryWrapper.eq(null!=lzx.getName(),Lzx::getName,lzx.getName()));
        return "5466";
    }
    @PostMapping("/test")
    public String test() {
        HashMap<Object, Object> objectObjectHashMap = new HashMap<>();
        //新建一个jdbc连接


        return null;
    }
}
